package com.cos.shop.util;

/**
 * @author: COS
 * @time: 2022/9/5 16:37
 * @description:
 */
public class StringUtils {
    /**
     * @author: COS
     * @return:
     * @time: 2022/9/5 16:38
     * @description: 字符串不为空判断
     */
    public static boolean isNotEmpty(String... strs) {
        for (String str : strs) {
            // 为null 或者是空字符串
            if (str == null || str.trim().length() == 0) {
                return false;
            }
        }
        return true;
    }
    /**
     *
     * @author: COS
     * @return:
     * @time: 2022/9/8 9:47
     * @description: 字符串转 数值
     */
    public static int stringToInt(String num){
        try {
            return Integer.valueOf(num);
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
        return -1;
    }
    public static double stringToDouble(String num){
        try {
            return Double.valueOf(num);
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
        return -1;
    }
}
